<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="copyright" content="闻康集团刘代明监制" />
<meta name="robots" content="all" />
<?php echo $css_file;?>
<style type="text/css">
	.regItem label.error{padding-left:20px;background:url(__PUBLIC__/Images/admin/onError.gif) no-repeat;}
	.regItem label.correct{padding-left:20px;background:url(__PUBLIC__/Images/admin/onCorrect.gif) no-repeat;}
</style>
</head>
<body>
<div class="main">
	<div class="crumbs">
	当前位置：<span id="current_pos">设置->添加用户</span>
	</div>
    <div class="m_content" id="right_main">
        <div class="content_menu blue line-x">
        	<a class="on" href="__GROUP__/Setting/userlist"><em>用户列表</em></a>
        </div>	
        <form action="__GROUP__/Setting/addSave" method="post" enctype="multipart/form-data" id="registerForm">
        	<div class="tableform" id="tab_1">
           		<h5>基本信息</h5>
           		<div class="division">
           			<table cellspacing="0" cellpadding="0" border="0" class="shop_config">
                    	<tbody>
                            <tr class="regItem">
                        		<th>用户名：</th>
                        		<td><input type="text" class="text" id="uName" name="uName" maxlength="120" /> </td>
            				</tr>
            				<tr class="regItem">
                        		<th>真实名称：</th>
                        		<td><input type="text" class="text" id="rName" name="rName" maxlength="120" /> </td>
            				</tr>
            				<tr class="regItem">
                        		<th>用户角色：</th>
                        		<td>
                        		<select name="role" class="select" id="role">
                        		<?php
                        		foreach ($role as $val){
                        			if($val['role_id']!=1){
                        				echo '<option value="'.$val['role_id'].'">'.$val['name'].'</option>';
                        			}
                        		}
                        		?>
                        		</select>
                        		</td>
            				</tr>
                            <tr class="regItem">
                        		<th>邮箱：</th>
                        		<td><input type="text" class="text" id="uEmail" name="uEmail" maxlength="120" /> <span class="red">*</span></td>
            				</tr>
                            <tr class="regItem">
                        		<th>设置密码：</th>
                        		<td><input type="password" class="text" id="uPsw" name="uPsw" maxlength="120" /> <span class="red">*</span></td>
            				</tr>
                            <tr class="regItem">
                        		<th>确认密码：</th>
                        		<td><input type="password" class="text" id="uAgainPsw" name="uAgainPsw" maxlength="120" /> <span class="red">*</span></td>
            				</tr>
             			</tbody>
           			</table>
        		</div>
			</div>
            <div style="text-align:center;">
                <input type="submit" class="button" value="确定 " name="submit" />
                <input type="reset" class="button" value="重置 " name="reset" />
            </div>
        </form>
    </div>
</div>
<?php echo $js_file,$validate;?>
<script type="text/javascript">
$(document).ready(function() {
    $("#uName").focus();
	//信息验证
	jQuery.validator.addMethod("noNum", function(value) {
		return !(/^\d*$/.test(value));
	}, '不能为纯数字');

	jQuery.validator.addMethod("matchName", function(value) {
		return (/^[_a-zA-Z0-9\u4e00-\u9fa5]{2,20}$/.test(value));
	}, '含有非法字符');
	$.validator.methods.ajaxCheck = function(value, element, url) {
		var nurl = url + '?' + element.name + '=' + value;
		var value = "";
		$.ajax({
			type : "get",
			async : false,// 发送同步请求信息,等待服务器返回数据
			url : nurl,
			success : function(msg) {
				value = msg;
			}
		});
		if (value === "no") {
			return false;
		} else if (value === "yes") {
			return true;
		}
	};
	$("#registerForm").validate({
		rules : {
//			uName : {
//				required : false,
//				rangelength : [ 2, 20 ],
//				noNum : true,
//				matchName : true,
//				ajaxCheck : '__GROUP__/Setting/checkname'
//			},
			uEmail : {
				required : true,
				maxlength : 60,
				email : true,
				ajaxCheck : "__GROUP__/Setting/checkemail"
			},
			uPsw : {
				required : true,
				rangelength : [ 6, 20 ]
			},
			uAgainPsw : {
				required : true,
				rangelength : [ 6, 20 ],
				equalTo : "#uPsw"
			}
		},
		messages : {
//			uName : {
//				required : "请输入用户名",
//				rangelength : "会员名为{0}-{1}个字符",
//				ajaxCheck : "该用户名已被注册"
//			},
			uEmail : {
				required : "请输入邮箱",
				maxlength : "邮箱不能超过{0}个字符",
				email : "邮箱格式不对",
				ajaxCheck : "该邮箱已被注册"
			},
			uPsw : {
				required : "请输入密码",
				rangelength : "密码为{6}-{20}个字符"
			},
			uAgainPsw : {
				required : "请确认密码",
				rangelength : "密码为{6}-{20}个字符",
				equalTo : "两次密码输入不一致"
			}
		},
		success : function(label) {
			label.addClass("correct").text("正确");
		},
		onkeyup : false,
		errorPlacement : function(error, element) {
                        error.appendTo(element.parent());
		}
	});
});
</script>
</body>

</html>
			
